package com.example.pickupclosefirstdemo.main;

import android.view.View;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.pickupclosefirstdemo.R;

public class PickUpViewModule extends ViewModel {

    private final MutableLiveData<String> number = new MutableLiveData<>();

    public MutableLiveData<String> getNumber() {
        if (number == null) {
            number.setValue("0");
        }
        return number;
    }

    public void addNumber(String n){
        if (number == null) {
            number.setValue("0");
        }
        number.postValue(number.getValue() + "," + n);
    }

    public void puvm(View view){
        switch (view.getId()){
            case R.id.btnModuleAdd:
                addNumber("2");
                break;
            case R.id.btnModuleDelete:
                addNumber("3");
                break;
            default:
        }
    }

}
